(i) Field of the Invention
The present invention relates to a semiconductor memory apparatus for reading data and then zero-clearing, and more particularly to a semiconductor memory apparatus which is imbedded in an image compressing/uncompressing LSI and the like and suitable for run-length encoding or zigzag scan conversion.
(ii) Description of the Related Art
In an image compressing/uncompressing technique such as MPEG, there is used an encoding technique by which an original image is divided into blocks and quadrature conversion such as DCT (Discrete Cosine Transform) is applied to each block to quantize its DCT coefficients, and then the quantized coefficients are aligned in data rows in the zigzag scanning order to perform run-length encoding in the zero-run+non-zero coefficient format.
FIG. 9 shows an example of typical zigzag scanning. In the drawing, a lattice area indicates pixel positions of a block composed of 8×8 pixels in the vertical and horizontal directions, and numeric figures in the lattice area indicate orders for rearranging data. In this example, each pixel is arranged in order, i.e. a pixel (0, 0) is arranged at zeroth; a pixel (0, 1), at first; and a pixel (1, 0), at second, . . . .
FIG. 10 shows an example in which zigzag scan conversion is performed based on the quantized DCT coefficients to carry out run-length encoding. FIG. 10A shows the quantized DCT coefficients of a block composed of 8×8 pixels and includes many zero components as a result of quantization. When the quantized DCT coefficients are aligned in the order of arrows, a data string such as shown in FIG. 10B is obtained. When a non-zero coefficient and a number of zeros (zero runs) immediately before that coefficient forms a pair as one symbol with respect to this data string, 10 run-length codes such as shown in FIG. 10C are obtained.
As a technique for decoding block data subjected to zigzag scanning and run-length encoding by the above-described procedure, there is a technique for preparing a zero-cleared memory in advance and writing only non-zero coefficients for addresses skipped by the zero run.
FIG. 11 is a schematic block diagram of this technique. An apparatus shown in FIG. 11 includes a run-length address generator 11, a bank memory 1 composed of two two-port memories, and a zigzag address generator 12. The bank memory 1 shown in FIG. 11 has, for example, two bank areas and can simultaneously perform writing at addresses generated by the run-length generator 11 and reading from addresses generated by the zigzag address generator 12. Incidentally, if the performance can be degraded by half, only one bank may be provided and the same bank may be sequentially switched without simultaneously performing writing and reading.
With a bank selection signal shown in FIG. 11, one bank area is used for writing and the other bank area is used for reading. FIG. 11 shows an example in which a bank area B0 is used for writing and a bank area B1 is used for reading.
The run-length address generator shown in FIG. 11 adds a register which is first initialized to “−1”, zero runs and 1 in an accumulative adder composed of a register 21 and an adder 22, and updates the register with the added result. Thereafter, the run-length address generator increments a value of the register by “zero runs+1” and determines the incremented value as an address for writing.
Taking run-length codes in FIG. 10C as an instance, data is stored in the memory in the order of arrangement in FIG. 10B. For example, 132 is written at an address 0, 23 is written at an address 1, 56 is written at an address 3, . . . . Then, processing for one block is completed by 10 times of writing.
On the other hand, when reading a content of the bank memory 1, data is read from addresses generated by the zigzag address generator 12, and zeros are written in the memory areas from which data has been read.
When reading data in the order of, e.g., horizontal scanning, the zigzag address generator 12 generates addresses in the order of 0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, . . . , as shown in FIG. 9. A zigzag address generator 12 for generating such addresses can be readily composed of a counter and a conversion table.
Furthermore, if the conversion table is changed, data can be read in any order. Thus, zeros are written while data is read on the reading side, the bank memory 1 is initialized to zero when the reading of all the addresses is finished, and it can be used as a bank for writing next data.
Incidentally, when neither bank is yet initialized, a circuit for writing zeros for initialization can be additionally provided. Moreover, data of run-zero data-zero can be written for blocks at the writing size, an all the memory areas can be zero-cleared by reading and nullifying data at the reading side.
In the apparatus shown in FIG. 11, it is possible to efficiently carry out the decoding operation. However, as apparent from the memory at the reading side, the read modified write operation is required, and two-port memories which can simultaneously perform reading and writing are necessary. When the bit/word configuration of the memory is the same, an area of the memory increases in proportion to a number of ports. Therefore, the bank memory 1 of this apparatus has a circuit scale which is approximately two fold of that of two banks composed of one-port memories having the same bit/word configuration.
On the other hand, FIG. 12 is a schematic block diagram in which the function similar to that of the decoding circuit in FIG. 11 is realized by one-port memories. The apparatus of FIG. 12 is provided with the one-port memories one by one, to simultaneously execute run-length address writing, zigzag address reading and zero-clearing.
FIG. 12 shows an example in which a bank area composed of a one-port memory M1 is used for run-length address writing, a bank area composed of a one-port memory M2 is used for zigzag address reading, and a bank area composed of a one-port memory M3 is used for zero-clearing. By sequentially switching uses of the three bank areas every time the bank selection signal is changed over, the function which is substantially the same as that of the two-port memories shown in FIG. 11 ca be realized. In addition, the circuit scale can be reduced to approximately ¾ of that illustrated in FIG. 11.
However, since the both apparatuses depicted in FIGS. 11 and 12 has the zero clear function thereto, there is a problem that a circuit area is greatly increased (approximately two fold in FIG. 11, and approximately 1.5 fold in FIG. 12) as compared with regular bank memories having two banks each having one-port memories. Therefore, a chip area becomes large when integrated, thereby increasing the chip cost.